﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using System.Windows.Media.Imaging;
using System.Windows.Data;

namespace Galnote.PreviewList
{
	public partial class PreviewDisplay : Page
	{
		public PreviewDisplay()
		{
			InitializeComponent();
		}

		// 当用户导航到此页面时执行。
		protected override void OnNavigatedTo(NavigationEventArgs e)
		{
		}

		private void PreviewImageList_Loaded(object sender, RoutedEventArgs e)
		{
			Works WP10 = new Works();
			WP10.Image = new BitmapImage(new Uri(@"/Images/00010.jpg", UriKind.Relative));
			WP10.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP10.Author = "存在ちあき123456789abcdefghijkl";
			WP10.Avatar = new BitmapImage(new Uri(@"/Images/Avatar.jpg", UriKind.Relative));
			WP10.TimeData = "1 Day 2Hours 32Mins";

			Works WP11 = new Works();
			WP11.Image = new BitmapImage(new Uri(@"/Images/00003.jpg", UriKind.Relative));
			WP11.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP11.Author = "存在ちあき";
			WP11.Avatar = new BitmapImage(new Uri(@"/Images/Avatar.jpg", UriKind.Relative));
			WP11.TimeData = "1 Day 2Hours 32Mins";

			Works WP12 = new Works();
			WP12.Image = new BitmapImage(new Uri(@"/Images/00004.jpg", UriKind.Relative));
			WP12.Title = "这个用来测试不同的名字";
			WP12.Author = "存在ちあき";
			WP12.TimeData = "1 Day 2Hours 32Mins";

			Works WP13 = new Works();
			WP13.Image = new BitmapImage(new Uri(@"/Images/00006.jpg", UriKind.Relative));
			WP13.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP13.Author = "存在ちあき";
			WP13.TimeData = "1 Day 2Hours 32Mins";

			Works WP14 = new Works();
			WP14.Image = new BitmapImage(new Uri(@"/Images/00008.jpg", UriKind.Relative));
			WP14.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP14.Author = "存在ちあき";
			WP14.TimeData = "1 Day 2Hours 32Mins";

			Works WP15 = new Works();
			WP15.Image = new BitmapImage(new Uri(@"/Images/00006.jpg", UriKind.Relative));
			WP15.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP15.Author = "存在ちあき";
			WP15.TimeData = "1 Day 2Hours 32Mins";

			Works WP16 = new Works();
			WP16.Image = new BitmapImage(new Uri(@"/Images/MS001.jpg", UriKind.Relative));
			WP16.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP16.Author = "存在ちあき";
			WP16.TimeData = "1 Day 2Hours 32Mins";

			Works WP17 = new Works();
			WP17.Image = new BitmapImage(new Uri(@"/Images/MS001.jpg", UriKind.Relative));
			WP17.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP17.Author = "存在ちあき";
			WP17.TimeData = "1 Day 2Hours 32Mins";

			Works[] data = { WP10, WP11, WP12, WP13, WP14, WP15, WP16, WP17, WP10, WP11, WP12, WP13, WP14, WP15, WP16, WP17, WP10, WP11, WP12, WP10, WP10, WP15, WP16, WP17 };
			PreviewImageList.ItemsSource = data;

			PagedCollectionView P = new PagedCollectionView(data);
			PreviewImageList.ItemsSource = P;
			PreviewImageListDP.Source = P;
		}

		private void PreviewRatio_PreviewRatioClick_1(object sender, RoutedEventArgs e)
		{
			LayoutRoot.ColumnDefinitions[0].Width = new GridLength(0.618, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[1].Width = new GridLength(0, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[2].Width = new GridLength(1, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[3].Width = new GridLength(0, GridUnitType.Star);
			LayoutRoot.UpdateLayout();
			PreviewImageList.ItemsPanel=(ItemsPanelTemplate)this.Resources["IPT3x5"];
			PreviewImageListDP.PageSize = 15;
		}

		private void DownloadToPreviewButton_Click(object sender, RoutedEventArgs e)
		{
			LayoutRoot.ColumnDefinitions[0].Width = new GridLength(0, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[1].Width = new GridLength(0.15, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[2].Width = new GridLength(1, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[3].Width = new GridLength(0, GridUnitType.Star);
			LayoutRoot.UpdateLayout();
			PreviewImageList.ItemsPanel = (ItemsPanelTemplate)this.Resources["IPT3x7"];
			PreviewImageListDP.PageSize = 21;
		}

		private void ShowcasedList_Loaded(object sender, RoutedEventArgs e)
		{
			Works WP10 = new Works();
			WP10.Image = new BitmapImage(new Uri(@"/Images/00010.jpg", UriKind.Relative));
			WP10.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP10.Author = "存在ちあき";
			WP10.Avatar = new BitmapImage(new Uri(@"/Images/Avatar.jpg", UriKind.Relative));
			WP10.TimeData = "1 Day 2Hours 32Mins";

			Works WP11 = new Works();
			WP11.Image = new BitmapImage(new Uri(@"/Images/00003.jpg", UriKind.Relative));
			WP11.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP11.Author = "存在ちあき";
			WP11.Avatar = new BitmapImage(new Uri(@"/Images/Avatar.jpg", UriKind.Relative));
			WP11.TimeData = "1 Day 2Hours 32Mins";

			Works WP12 = new Works();
			WP12.Image = new BitmapImage(new Uri(@"/Images/00004.jpg", UriKind.Relative));
			WP12.Title = "这个用来测试不同的名字";
			WP12.Author = "存在ちあき";
			WP12.TimeData = "1 Day 2Hours 32Mins";

			Works WP13 = new Works();
			WP13.Image = new BitmapImage(new Uri(@"/Images/00006.jpg", UriKind.Relative));
			WP13.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP13.Author = "存在ちあき";
			WP13.TimeData = "1 Day 2Hours 32Mins";

			Works WP14 = new Works();
			WP14.Image = new BitmapImage(new Uri(@"/Images/00008.jpg", UriKind.Relative));
			WP14.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP14.Author = "存在ちあき";
			WP14.TimeData = "1 Day 2Hours 32Mins";

			Works WP15 = new Works();
			WP15.Image = new BitmapImage(new Uri(@"/Images/00006.jpg", UriKind.Relative));
			WP15.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP15.Author = "存在ちあき";
			WP15.TimeData = "1 Day 2Hours 32Mins";

			Works WP16 = new Works();
			WP16.Image = new BitmapImage(new Uri(@"/Images/MS001.jpg", UriKind.Relative));
			WP16.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP16.Author = "存在ちあき";
			WP16.TimeData = "1 Day 2Hours 32Mins";

			Works WP17 = new Works();
			WP17.Image = new BitmapImage(new Uri(@"/Images/MS001.jpg", UriKind.Relative));
			WP17.Title = "あの日见た花の名前を仆达はまだ知らない";
			WP17.Author = "存在ちあき";
			WP17.TimeData = "1 Day 2Hours 32Mins";

			Works[] data = { WP10, WP11, WP12, WP13, WP14, WP15, WP16, WP17, WP10, WP11, WP12, WP13, WP14, WP15, WP16, WP17, WP10, WP11, WP12, WP10, WP10, WP15, WP16, WP17 };
			ShowcasedList.ItemsSource = data;

			PagedCollectionView P = new PagedCollectionView(data);
			ShowcasedList.ItemsSource = P;
			ShowcasedListDP.Source = P;
		}

		private void AboutMeAvatarButton_Click(object sender, RoutedEventArgs e)
		{
			LayoutRoot.ColumnDefinitions[0].Width = new GridLength(0.618, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[1].Width = new GridLength(0, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[2].Width = new GridLength(0, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[3].Width = new GridLength(1, GridUnitType.Star);
			LayoutRoot.UpdateLayout();
		}

		private void AboutMeTextButton_Click(object sender, RoutedEventArgs e)
		{
			LayoutRoot.ColumnDefinitions[0].Width = new GridLength(0.618, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[1].Width = new GridLength(0, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[2].Width = new GridLength(0, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[3].Width = new GridLength(1, GridUnitType.Star);
			LayoutRoot.UpdateLayout();
		}

		private void BackToDownloadButton_Click(object sender, RoutedEventArgs e)
		{
			LayoutRoot.ColumnDefinitions[0].Width = new GridLength(0.618, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[1].Width = new GridLength(0, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[2].Width = new GridLength(1, GridUnitType.Star);
			LayoutRoot.ColumnDefinitions[3].Width = new GridLength(0, GridUnitType.Star);
			LayoutRoot.UpdateLayout();
		}

		private void FriendList_Loaded(object sender, RoutedEventArgs e)
		{
			UserInfo C1 = new UserInfo();
			C1.Avatar = new BitmapImage(new Uri(@"/Images/Avatar.jpg", UriKind.Relative));
			C1.UserID = "存在";

			UserInfo C2 = new UserInfo();
			C2.Avatar = new BitmapImage(new Uri(@"/Images/Avatar.jpg", UriKind.Relative));
			C2.UserID = "存在";

			UserInfo C3 = new UserInfo();
			C3.Avatar = new BitmapImage(new Uri(@"/Images/Avatar.jpg", UriKind.Relative));
			C3.UserID = "存在";

			UserInfo C4 = new UserInfo();
			C4.Avatar = new BitmapImage(new Uri(@"/Images/Avatar.jpg", UriKind.Relative));
			C4.UserID = "存在";

			UserInfo C5 = new UserInfo();
			C5.Avatar = new BitmapImage(new Uri(@"/Images/Avatar.jpg", UriKind.Relative));
			C5.UserID = "存在";

			UserInfo C6 = new UserInfo();
			C6.Avatar = new BitmapImage(new Uri(@"/Images/Avatar.jpg", UriKind.Relative));
			C6.UserID = "存在";

			UserInfo[] data = { C1, C2, C3, C4, C5, C6, C1, C2, C3, C4, C5, C6, C1, C2, C3, C4, C5, C6, C1, C2, C3, C4, C5, C6 };
			FriendList.ItemsSource = data;

			PagedCollectionView P = new PagedCollectionView(data);
			FriendList.ItemsSource = P;
			FriendListDP.Source = P;
		}

	}
}
